<?php
/**
 * 系統名稱: Lotto 系統
 * 檔案說明: 專案管理-修改
 * $Author$
 * $Id$
 *
 */
include_once("../../config.inc.php");
$_LangPath = "usercredit_userpwd";
include_once(__Admin_Path."/logincheck.php");
include_once(__Language_Path."/selectlanguage_admin.php");
include_once(__Modules_Path."/Utility.lib.php");
include_once(__Modules_Path."/Password.lib.php");
include_once(__Modules_Path."/UserSessions.lib.php");

$Force = trim($_data["Force"]);
$Password = trim($_data["Password"]);
$Password_o = trim($_data["Password_o"]);
$Password_c = trim($_data["Password_c"]);
$PWD = GetRelationType3 ("bet_Member"," ID = ".$_SESSION["Admin_Info"] -> ID," Password as Value ");


$arrErr = UpdatePassword($PWD, $Password, $Password_o, $Password_c, $_SESSION["Admin_Info"] -> ID, $_SESSION["Admin_Info"] -> Account, $_SESSION["Admin_Info"] -> Name, $_strUserPWD);

$fp = @file(__Admintemplate_Path."/UserCredit/user_pwdupdate.html");
$fp = implode("", $fp);
$fp = setHTMLCharset($fp);

$fp = str_replace("{PWD}", $_strUserPWD["PWD"], $fp);
$fp = str_replace("{Message}", $arrErr["message"], $fp);
$fp = str_replace("{Back}", $_strUserPWD["Back"], $fp);

if($arrErr["err"]){
	$fp = preg_replace("/<!--@ Index Start @\/\/-->.+<!--@ Index End @\/\/-->/s", "", $fp);
}else{
	if($Force == "Yes"){
		if(!UserSession_End(session_id(), $_SESSION["Admin_Info"] -> ID))ErrMsgOutputHTML("LoginError", "", 1);
		if(!UserSession_Clear())ErrMsgOutputHTML("LoginError", "", 1);
		$fp = preg_replace("/<!--@ Back Start @\/\/-->.+<!--@ Back End @\/\/-->/s", "", $fp);
	}else{
		$fp = preg_replace("/<!--@ Index Start @\/\/-->.+<!--@ Index End @\/\/-->/s", "", $fp);
		$fp = preg_replace("/<!--@ Back Start @\/\/-->.+<!--@ Back End @\/\/-->/s", "&nbsp;", $fp);
	}
}

//輸出
WebOutputHTML($fp, 1);
?>